package hc.j2me.util;

import javax.microedition.lcdui.Display;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import javax.microedition.rms.RecordEnumeration;
import javax.microedition.rms.RecordStore;

public class ViewLog extends MIDlet {

	protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
	}

	protected void pauseApp() {
	}

	protected void startApp() throws MIDletStateChangeException {
		javax.microedition.lcdui.Form f = new javax.microedition.lcdui.Form("");
		
		String rms = "log";
		RecordStore newrs = null;
		try {
			newrs = RecordStore.openRecordStore(rms, false);
			
			RecordEnumeration re = newrs.enumerateRecords(null, null, false);
			while(re.hasNextElement()){
				byte[] bs = re.nextRecord();
				f.append(new String(bs, 0, bs.length));
			}
		}catch (Exception e) {
			f.append(e.getMessage());
		}
		
		Display.getDisplay(this).setCurrent(f);
	}

}
